package se.jocke.nb.log.ui;

import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;

/**
 *
 * @author jocke
 */
public class TailAdjustmentListener implements AdjustmentListener {

    private boolean adjust = true;

    @Override
    public void adjustmentValueChanged(AdjustmentEvent e) {
        if (adjust) {
            e.getAdjustable().setValue(e.getAdjustable().getMaximum());
        }
    }

    public void toggle() {
        this.adjust = !adjust;
    }

}
